<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="course-item">
    <image class="course-item-img" :src="info.pic" mode="aspectFill" />
    <view class="course-item-content">
      <view class="course-item-name">{{ info.title }}</view>
      <view style="display: flex; align-items: flex-end">
        <view class="course-item-tag">{{ info.tag }}</view>
        <view class="course-item-btn">赠送课程</view>
      </view>
    </view>
  </view>
</template>

<style lang="scss">
.course-item {
  position: relative;
  display: flex;
  padding: 30rpx;

  .course-item-img {
    flex-shrink: 0;
    width: 280rpx;
    height: 150rpx;
    border-radius: 16rpx;
  }

  .course-item-content {
    flex-grow: 1;
    min-width: 0;
    margin-left: 20rpx;
  }

  .course-item-name {
    max-height: 84rpx;
    margin-bottom: 6rpx;
    font-size: 28rpx;
    color: #333333;
    line-height: 42rpx;
    font-weight: bold;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .course-item-tag {
    padding: 0 10rpx;
    font-size: 20rpx;
    color: #ffa300;
    line-height: 32rpx;
    border-radius: 8rpx;
    background-color: rgba(255, 203, 110, 0.2);
  }

  .course-item-btn {
    padding: 0 36rpx;
    font-size: 26rpx;
    color: #ff5e00;
    line-height: 60rpx;
    font-weight: bold;
    border-radius: 10rpx;
    background-color: rgba(255, 98, 0, 0.05);
  }
}
</style>